Skip to content

feat(crons): Add rufus-scheduler cron monitoring - #3110

Merged
wedamija merged 6 commits into
masterfrom
danf/rufus-scheduler-crons
Oct 21, 2026
Merged

wedamija merged 6 commits into
masterfrom
danf/rufus-scheduler-crons

Conversation

@wedamija

@wedamija wedamija commented Oct 3, 2026 •

Copy link
Copy Markdown
Member

Part of a series that sends Crons monitor configs from Ruby schedulers. Check-ins for a monitor that does not exist yet are dropped, so today every monitor has to be created by hand with its schedule copied from the code. Sending the schedule lets Sentry create the monitor and keep it in sync.

This adds an opt-in patch for rufus-scheduler:

config.enabled_patches << :rufus_scheduler

cron and every jobs send in-progress and ok/error check-ins, with the job's schedule as the monitor config.

  • The slug is the job's name:, or the handler's class or method. Unnamed blocks aren't monitored, and sentry_monitor: false opts a job out.
  • interval jobs and schedules Sentry can't represent check in without a config. One-off in and at jobs aren't monitored.
  • Errors still reach rufus's on_error.

Stacked on #3141. The lockfile changes only add rufus-scheduler as a dev dependency.

Docs: getsentry/sentry-docs#19789

@wedamija
wedamija force-pushed the danf/rufus-scheduler-crons branch from bb10236 to d9306dd Compare October 15, 2026 18:57
@wedamija
wedamija force-pushed the danf/rufus-scheduler-crons branch from d9306dd to 75667e8 Compare October 16, 2026 17:02
@wedamija
wedamija changed the base branch from master to danf/cron-fugit-config October 16, 2026 17:03
@wedamija
wedamija marked this pull request as ready for review October 16, 2026 23:59
Base automatically changed from danf/cron-fugit-config to master October 21, 2026 14:23
@sl0thentr0py
sl0thentr0py force-pushed the danf/rufus-scheduler-crons branch from 7320f2c to 8bebc37 Compare October 21, 2026 14:31
wedamija and others added 5 commits October 21, 2026 17:55
Opt-in via `config.enabled_patches << :rufus_scheduler`. Sends
in_progress/ok/error check-ins for cron, every and interval jobs, with a
monitor config for cron and fixed-interval every jobs, built with
Sentry::Cron::FugitSchedule.

Jobs run unmonitored when building the monitor fails. Method handlers
are named after their owner and method, unnamed blocks are skipped with
a log asking for name:, and long slugs keep their first 50 characters.

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Method handlers were slugged by the class that defines the method, so
subclasses sharing an inherited method, or classes sharing a mixin
method, collided on one monitor.

Co-Authored-By: Claude <noreply@anthropic.com>
Matches the sidekiq-cron and sidekiq-scheduler patches, so the patch
still applies when rufus-scheduler is loaded after Sentry.init.

Co-Authored-By: Claude <noreply@anthropic.com>
@sl0thentr0py
sl0thentr0py force-pushed the danf/rufus-scheduler-crons branch from 8bebc37 to e94ab09 Compare October 21, 2026 15:55
@linear-code

linear-code Bot commented Oct 21, 2026

Copy link
Copy Markdown

RUBY-233

Avoids the backtracking /-+\z/ regex that CodeQL flags, and strips every
trailing dash left by truncation.

Co-Authored-By: Claude <noreply@anthropic.com>
@wedamija
wedamija merged commit 475a5c5 into master Oct 21, 2026
156 checks passed
@wedamija
wedamija deleted the danf/rufus-scheduler-crons branch October 21, 2026 21:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants